<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style>
			#div1 {
				width: 200px;
				/*height: 50px;*/
				padding: 10px 20px 20px 10px;
				background: red;
				margin: 0 auto;
			}

			#div2 {
				width: 100px;
				height: 100px;
				background: green;
				float: left;
			}
			
			#box{
				/* overflow: hidden; */
				position: relative;
				background-color: skyblue;
			}
			.child1, .child2 {
				position: relative;
				float: left;
				width: 100px;
				height: 100px;
				margin-top: 20px;
			}
			.child1{
				background-color: red;
			}
			.child2{
				background-color: blue;
			}
			.other{
				clear: both;
				width: 300px;
				height: 150px;
				background-color: hotpink;
			}
		</style>
	</head>
	<body>
		<!-- 
			1. 隐藏超出部分
			2. 清除浮动
			3. 解决 margin 塌陷问题
		 -->
		 
		<!-- <div id="div1">
			<div id="div2"></div>
		</div> -->
		<div id="box">
			<div class="child1">子元素1</div>
			<div class="child2">子元素2</div>
		</div>
		<div class="other">其他部分</div>
	</body>
</html>
